package com.bestv.engine.model.user.impl;

import com.bestv.database.vo.ItemRelation;
import com.bestv.engine.model.RecommendationModel;
import com.bestv.utils.database.DBConnectionManager;
import com.bestv.utils.database.JDBCHelper;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Henry on 14-5-29.
 */
public class UserFavoriteModel extends RecommendationModel {
    @Override
    protected List<Object> getItemRelations(long itemId, int typeId, int maxCount) {
        Connection conn = DBConnectionManager.getSlaveConnection();
        String sql = String.format("SELECT * FROM %s WHERE LeftId=? ORDER BY Significance LIMIT ?", "modeluserfavorite");
        ArrayList<Object> rs = JDBCHelper.executeQuery(conn, sql, ItemRelation.class, itemId, maxCount);
        JDBCHelper.close(conn);
        return rs;
    }
}
